class AddStudentPermissions < ActiveRecord::Migration
  def self.create_permission(name, role, level)
    Permission.new({'name'=>name, 'role'=>role, 'level'=>level}).save!
  end

  def self.destroy_permission(name, role, level)
    thing = Permission.find_by_name_and_role_and_level(name,role,level)
    thing.destroy
  end

  def self.up
	  self.create_permission('create:landmark','super','1')
	  self.create_permission('edit:landmark','super','1')
	  self.create_permission('delete:landmark','super','1')
	  self.create_permission('create:route','super','1')
	  self.create_permission('edit:route','super','1')
	  self.create_permission('delete:route','super','1')
	  self.create_permission('reorder:route','super','1')
  end

  def self.down
	  self.destroy_permission('create:landmark','super','1')
	  self.destroy_permission('edit:landmark','super','1')
	  self.destroy_permission('delete:landmark','super','1')
	  self.destroy_permission('create:route','super','1')
	  self.destroy_permission('edit:route','super','1')
	  self.destroy_permission('delete:route','super','1')
	  self.destroy_permission('reorder:route','super','1')
  end
end
